﻿using Logistics.Web.Models.Common;
using Nop.Core.Domain.Logistics;
using Nop.Core.Domain.Shipping;
using System;
using System.ComponentModel.DataAnnotations;

namespace Logistics.Web.Models.Track
{
    public partial class PackageLocationModel
    {
        private AddressModel _address;
        private string _addressType;

        public int LocationId { get; set; }

        public int AddressId { get; set; }
        public AddressModel Address
        {
            get { return _address ?? (_address = new AddressModel()); }
            protected set { _address = value; }
        }

        public string AddressZone { get; set; }

        public string AddressType {
            get
            {
                return String.IsNullOrEmpty(_addressType) ? "" : _addressType;
            }

            set
            {
                _addressType = value;
            }
        }

        public DateTime? UpdatedOnUtc { get; set; }

        [UIHint("DecimalNullable")]
        public decimal? Rank { get; set; }

        public LocationStatus LocationStatus { get; set; }
        public string Action { get; set; }

        public int PlanId { get; set; }
        public int CourierId { get; set; }

        public int PackageId { get; set; }
        public ShippingStatus ShippingStatus { get; set; }

        // This is to help driver know how many packages within the plan 
        // is tied to the same location (either for pickup or dropoff)
        // when driver is at the location. (incl. the current package itself).
        public int? SamePickupLocationNumItems { get; set; }
        public int? SameDeliveryLocationNumItems { get; set; }

        public string Attribute { get; set; }
        public string Reference { get; set; }
    }
}